/*
 * 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙，邂逅框架梦]
 * 
 * https://zhiqim.org/project/zhiqim_framework/zhiqim_kernel.htm
 *
 * Zhiqim Kernel is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package org.zhiqim.kernel.constants;

import org.zhiqim.kernel.annotation.AnAlias;

/**
 * 正则表达式常量定义
 *
 * @version v1.0.0 @author zouzhigang 2014-2-27 新建与整理
 */
@AnAlias("RegexpConstants")
public interface RegexpConstants
{
    /** 需要转义的字符 */
    String ESCAPE                       = "*.?+$^[](){}|\\/";
    
    /*********************************************************************************************************************************************/
    //数字相关
    /*********************************************************************************************************************************************/
    
    String NUMERIC                      = "^\\d+$";//数字，至少1位
    String NUMERIC_N                    = "^\\d{n}$";//N位数字
    String NUMERIC_TN                   = "^\\d{n,}$";//至少N位数字
    String NUMERIC_N_M                  = "^\\d{n,m}$";//N-M位数字
    
    String INTEGER                      = "^(0|[\\+\\-]?[1-9]\\d*)$";//整数，支持正负数
    String INTEGER_P                    = "^[1-9]\\d*$";//正整数，第一个数字是1-9
    String INTEGER_N                    = "^\\-[1-9]\\d*$";//负整数，负号之后第一个数字是1-9
    String INTEGER_N_N                  = "^(0|[1-9]\\d*)$";//非负整数，0或者正整数
    String INTEGER_N_P                  = "^(0|\\-[1-9]\\d*)$";//非正整数，0或者负整数
    
    String FLOAT_INT                    = "^(0|[1-9]\\d*)(\\.\\d+)?$";//浮点值，支持多位小数
    String FLOAT                        = "^[\\+\\-]?(0|[1-9]\\d*)(\\.\\d+)?$";//浮点值，支持多位小数点，支持正负数
    
    String AMOUNT_INT_2R                = "^(0|[1-9]\\d*)(\\.\\d{1,2})?$";//标准元金额，支持0-2位小数
    String AMOUNT_INT_2R_FIXED          = "^(0|[1-9]\\d*)(\\.\\d{2})$";//固定元金额，两位小数
    String AMOUNT_2R                    = "^[\\+\\-]?(0|[1-9]\\d*)(\\.\\d{1,2})?$";//标准元金额，支持0-2位小数，支持正负数
    String AMOUNT_2R_FIXED              = "^[\\+\\-]?(0|[1-9]\\d*)(\\.\\d{2})$";//固定元金额，两位小数，支持正负数
    
    /*********************************************************************************************************************************************/
    //字符相关
    /*********************************************************************************************************************************************/
    
    String ALPHABAT                     = "^[A-Za-z]+$";//字母
    String ALPHABAT_UPPER               = "^[A-Z]+$";//大写字母
    String ALPHABAT_LOWER               = "^[a-z]+$";//小写字母

    String ALPHA_LOWER_NUMERIC          = "^[a-z0-9]+$";//小写字母或数字
    String ALPHA_UPPER_NUMERIC          = "^[A-Z0-9]+$";//大写字母或数字
    
    String ALPHA_NUMERIC                = "^[A-Za-z0-9]+$";//大写小字母和数字
    String ALPHA_NUMERIC_N_M            = "^[A-Za-z0-9]{n,m}$";//大写小字母和数字
    String ALPHA_NUMERIC_PA             = "^[A-Za-z][A-Za-z0-9]*$";//大写小字母和数字，字母开头
    String ALPHA_NUMERIC_PA_N_M         = "^[A-Za-z][A-Za-z0-9]{n,m}$";//大写小字母和数字，字母开头

    String ALPHA_NUMERIC_UL             = "^[A-Za-z0-9_]+$";//字母，数字或下划线
    String ALPHA_NUMERIC_UL_PA          = "^[A-Za-z_][A-Za-z0-9_]*$";//大写小字母和数字，字母或下划线开头，java变量和方法命名
    String ALPHA_NUMERIC_UL_DL_PA       = "^[A-Za-z_\\$][A-Za-z0-9_\\$]*$";//大写小字母和数字，字母或下划线或$开头，js变量和方法命名
    
    String ALPHA_NUMERIC_DOT            = "^[A-Za-z0-9\\.]+$";//字母，数字或点号，如版本号V1.0.0
    String ALPHA_NUMERIC_URL            = "^[A-Za-z0-9\\.\\-_~]+$";//字母，数字或.-_~（URL支持的四个字符）
    
    String ALPHABAT_DOUBLE              = "^[^x00-xff]+$";//双字节
    String CHINESE                      = "^[\u4e00-\u9fa5]+$";//中文
    String CHINESE_ALPHA_NUMERIC        = "^[\u4e00-\u9fa5A-Za-z0-9]+$";//中文大小写字母和数字
    
    String HEX                          = "^[A-Fa-f0-9]+$";//十六进制字符
    String MD5                          = "^[A-Fa-f0-9]{32}$";//32位十六进制字符
    
    //账号和密码支持的特殊符号共10个[._-`~!@#$%]，账号要求2-16位字母数字或中文开头，密码要求6-16位的大小写字母数字和特殊符号满足四选三
    String USER_CODE                    = "^[a-zA-Z0-9\\u4e00-\\u9fa5][._\\-`~!@#$%a-zA-Z0-9\\u4e00-\\u9fa5]{1,15}$";
    String USER_PASS                    = "^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[a-z])(?=.*[._\\-`~!@#$%])|(?=.*[A-Z])(?=.*[0-9])(?=.*[._\\-`~!@#$%])|(?=.*[a-z])(?=.*[0-9])(?=.*[._\\-`~!@#$%])).{6,16}$";
    
    /*********************************************************************************************************************************************/
    //需求表达式
    /*********************************************************************************************************************************************/
    
    String MOBILE                       = "^((\\+86)|(86)|)?(13[0-9]|14[0|1|4|5|6|7|8|9]|15[0|1|2|3|5|6|7|8|9]|16[1|2|5|6|7|8]|17[0-8]|18[0-9]|19[0|1|2|3|5|6|7|8|9])\\d{8}$";
    String MOBILE_11                    = "^(13[0-9]|14[0|1|4|5|6|7|8|9]|15[0|1|2|3|5|6|7|8|9]|16[1|2|5|6|7|8]|17[0-8]|18[0-9]|19[0|1|2|3|5|6|7|8|9])\\d{8}$";
    String IP                           = "^((?:[01]?\\d{1,2}|2[0-4]\\d|25[0-5])\\.){3}(?:[01]?\\d{1,2}|2[0-4]\\d|25[0-5])$";
    String MAC                          = "^[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}$";
    String QQ                           = "^[1-9]\\d{4,10}$";
    String POSTAL_CODE                  = "^[1-9]\\d{5}$";
    String EMAIL                        = "^([\\w-_]+(?:\\.[\\w-_]+)*)@((?:[a-z0-9]+(?:-[a-zA-Z0-9]+)*)+\\.[a-z]{2,6})$";
    String FILE_NAME                    = "(?!((^(?i)con$)|(^(?i)con\\..*)|(^(?i)prn$)|(^(?i)prn\\..*)|(^(?i)aux$)|(^(?i)aux\\..)|(^(?i)nul$)|(^(?i)nul\\..*)|(^(?i)com[0-9]$)|(^(?i)com[0-9]\\..*)|(^(?i)lpt[0-9]$)|(^(?i)lpt[0-9]\\..*)|(^\\s+)|(.*\\s$)|(^\\.$)))(^[^\\\\/\\:\\*\\?\\\"\\<\\>\\|]{1,255}$)";
    
    String DATE                         = "^(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$";
    String TIME                         = "^([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9])$";
    String DATE_TIME                    = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\\s(([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9]))$";
    String IDCARD                       = "^(\\d{6})((((19|20)[0-9]{2})(((0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))(\\d{3}[0-9xX*])$";
    
    /*********************************************************************************************************************************************/
    //表情符号
    /*********************************************************************************************************************************************/
    
    String SYMBOLS_UNICODE              = "[\u2300-\u23FF]|"+//杂项工业符号 (Miscellaneous Technical)
                                          "[\u2600-\u27FF]|"+//杂项符号 (Miscellaneous Symbols)  
                                          "[\u2B00-\u2BFF]|"+//杂项符号和箭头 (Miscellaneous Symbols and Arrows)  
                                          "[\uFE00-\uFE0F]";//变量选择符 (Variation Selector)
   
    String SYMBOLS_EMOJI_IOS            = "[\uD83C\uDC00-\uD83C\uDFFF]|" +
                                          "[\uD83D\uDC00-\uD83D\uDFFF]|" +
                                          "[\uD83E\uDC00-\uD83E\uDFFF]|" +
                                          "[\uD800\uDC00-\uDBFF\uDFFF]";//全部的D800-DBFF,DC00-DFFF
    
    String SYMBOLS_ALL                  = SYMBOLS_UNICODE + "|" + SYMBOLS_EMOJI_IOS;
    
    /*********************************************************************************************************************************************/
    //方法相关
    /*********************************************************************************************************************************************/
    
    String IS_REGEXP                    = "isRegexp";
    
    String IS_NUMERIC                   = "isNumeric";
    String IS_NUMERIC_LEN               = "isNumericLen";
    String IS_INTEGER                   = "isInteger";
    String IS_INTEGER_VALUE             = "isIntegerValue";
    
    String IS_ALPHA_NUMERIC             = "isAlphaNumeric";
    String IS_ALPHA_NUMERIC_LEN         = "isAlphaNumericLen";
    String IS_ALPHA_NUMERIC_PA_LEN      = "isAlphaNumericPALen";
    String IS_ALPHA_NUMERIC_UL_LEN      = "isAlphaNumericULLen";
    String IS_ALPHA_NUMERIC_UL_PA_LEN   = "isAlphaNumericULPALen";
    
    String IS_ALPHA_NUMERIC_DOT_LEN     = "isAlphaNumericDotLen";
    String IS_ALPHA_NUMERIC_URL_LEN     = "isAlphaNumericUrlLen";
    
    String IS_FLOAT                     = "isFloat";
    String IS_FLOAT_NONNEGATIVE         = "isFloatNonnegative";
    String IS_AMOUNT_2R                 = "isAmount2R";
    String IS_EMAIL                     = "isEmail";
    String IS_POSTAL_CODE               = "isPostalCode";
    String IS_IP                        = "isIP";
    String IS_MAC                       = "isMacAddress";
    
    String IS_MOBILE                    = "isMsisdn";
    String IS_MOBILE11                  = "isMsisdn11";
    String IS_DATE                      = "isDate";
    String IS_TIME                      = "isTime";
    String IS_DATE_TIME                 = "isDateTime";
    String IS_IDCARD                    = "isIdcard";
    String IS_USER_CODE                 = "isUserCode";
    String IS_USER_PASS                 = "isUserPass";
    
    //非正则表达式
    String IS_EMPTY                     = "isEmpty";
    String IS_NOT_EMPTY                 = "isNotEmpty";
    String IS_EQUAL                     = "isEqual";
    String IS_SCOPE                     = "isScope";

    String IS_SELECT                    = "isSelect";
    String IS_CHECKED                   = "isChecked";
    
    String IS_LEN                       = "isLen";
    String IS_BYTE_LEN                  = "isByteLen";
    String IS_LESS_THEN                 = "isLessThen";
    String IS_LESS_THEN_VALUE           = "isLessThenValue";
    String IS_LESS_EQUAL_THEN           = "isLessEqualThen";
    String IS_LESS_EQUAL_THEN_VALUE     = "isLessEqualThenValue";
    String IS_GREATER_THEN              = "isGreaterThen";
    String IS_GREATER_THEN_VALUE        = "isGreaterThenValue";
    String IS_GREATER_EQUAL_THEN        = "isGreaterEqualThen";
    String IS_GREATER_EQUAL_THEN_VALUE  = "isGreaterEqualThenValue";
}
